package com.kit.data.kitopeso;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.content.Context;

import com.google.firebase.FirebaseApp;
import com.kit.data.kitopeso.obj.KitoAppInfo;
import com.kit.data.kitopeso.obj.KitoPointInfo;
import com.kit.data.kitopeso.obj.KitoUserProcess;
import com.kit.data.kitopeso.analysis.AnalysisUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class KitoApp extends Application {


    @SuppressLint("StaticFieldLeak")
    private static KitoApp app;

    private final List<Activity> lists = new ArrayList<>();

    private KitoUserProcess process;

    private KitoAppInfo appInfo;

    private boolean isScore;

    private boolean isOrder;

    Context context;


    String[] deviceInfoTypes;


    HashMap<String, KitoPointInfo> pointList = new HashMap<>();

    boolean isInitPointList;

    int pointListId;

    String PageType="";


    public void addActivity(Activity activity) {
        lists.add(activity);
    }

    public void clearActivity() {
        for (Activity activity : lists) {
            activity.finish();
        }
        lists.clear();
    }



    public static KitoApp getInstance() {
        return app;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
//                FirebaseApp.initializeApp(this);
        AnalysisUtil.INSTANCE.initOnLaunch(this);
    }

    public  KitoUserProcess getProcess() {
        return process;
    }

    public void setProcess(KitoUserProcess process) {
        this.process = process;
    }


    public static KitoApp getApp() {
        return app;
    }

    public static void setApp(KitoApp app) {
        KitoApp.app = app;
    }

    public List<Activity> getLists() {
        return lists;
    }

    public KitoAppInfo getAppInfo() {
        return appInfo;
    }

    public void setAppInfo(KitoAppInfo appInfo) {
        this.appInfo = appInfo;
    }

    public boolean isScore() {
        return isScore;
    }

    public void setScore(boolean score) {
        isScore = score;
    }

    public boolean isOrder() {
        return isOrder;
    }

    public void setOrder(boolean order) {
        isOrder = order;
    }

    public Context getContext() {
        return context;
    }

    public void setContext(Context context) {
        this.context = context;
    }

    public String[] getDeviceInfoTypes() {
        return deviceInfoTypes;
    }

    public void setDeviceInfoTypes(String[] deviceInfoTypes) {
        this.deviceInfoTypes = deviceInfoTypes;
    }

    public HashMap<String, KitoPointInfo> getPointList() {
        return pointList;
    }

    public void setPointList(HashMap<String, KitoPointInfo> pointList) {
        this.pointList = pointList;
    }

    public boolean isInitPointList() {
        return isInitPointList;
    }

    public void setInitPointList(boolean initPointList) {
        isInitPointList = initPointList;
    }

    public int getPointListId() {
        return pointListId;
    }

    public void setPointListId(int pointListId) {
        this.pointListId = pointListId;
    }

    public String getPageType() {
        return PageType;
    }

    public void setPageType(String pageType) {
        PageType = pageType;
    }



}
